package com.bd.scm.module.system.impl;

import ch.qos.logback.core.spi.ScanException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bd.scm.dao.mapper.leave.KtQingjMapper;
import com.bd.scm.domain.models.leave.KtQingj;
import com.bd.scm.module.enums.ExceptionEmun;
import com.bd.scm.module.system.KtQingjService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mason
 * @since 2019-12-12
 */
@Service
public class KtQingjServiceImpl extends ServiceImpl<KtQingjMapper, KtQingj> implements KtQingjService {

    @Resource
    private KtQingjMapper ktQingjMapper;

    /**
     * 根据申请类型获取假类
     * 1：个人申请   2：批量申请
     *
     * @param applyType
     * @return
     */
    @Override
    public List<KtQingj> getLeaveType(int applyType) {
        LambdaQueryWrapper<KtQingj> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(KtQingj::getStatus, 0);
        //放班在排班那里处理，请假申请这里不放班
        queryWrapper.ne(KtQingj::getIshaveedu, 10);
//        if (1 == applyType) {
//            //个人申请
//            queryWrapper.ne(KtQingj::getIshaveedu, 10);
//        }
        queryWrapper.orderByAsc(KtQingj::getNo);

        return ktQingjMapper.selectList(queryWrapper);
    }
}
